import { ref, watch } from 'vue'
interface nums {
  num1: number,
  num2: number
}
const useAdd = (obj:nums)=> {
  const addNum = ref(0)
  watch([obj.num1, obj.num2], ([num1, num2]) => {
    addFn(num1,num2)
  }) 
  const addFn = (num1: number, num2: number) => {
    addNum.value = num1 + num2
  }
  return {
    addNum,
    addFn
  }
}

export default useAdd